uniform sampler2D texture0;
uniform vec2 light_pos;

void main(void)
{
	vec4 col = texture2D(texture0, gl_TexCoord[0].xy);
	//vec3 LightPos = vec3(gl_TexCoord[0].x - light_pos.x, gl_TexCoord[0].y - light_pos.y, -1);
	vec3 N = normalize((col.rgb - vec3(0.5,0.5,0.5)) * 2.0);
	vec3 L = -normalize(vec3(10,-10,1));
	//vec3 L = normalize(LightPos);
	//vec3 L = normalize(vec3(gl_TexCoord[0].x * -10, 10, gl_TexCoord[0].y * -10));
	//vec3 L = normalize(vec3(0,0,-1));
	float Idiff = max(0.4-dot(L,N), 0.0); 
	//Idiff = 1.0 - clamp(Idiff, 0.0, 1.0) * 0.5; 
	//Idiff = clamp(Idiff, 0.0, 1.0);

	vec4 diffuse = vec4(0,0.67,0.93, 0);
	vec4 ambient = diffuse * 0.3;
	if (length(col.rgb) > 0.6)
	{
		//vec4 pcol = vec4(Idiff, Idiff, Idiff, 0) * 0.5 + vec4(0,0.67,0.93, 0) * 0.5;
		vec4 pcol = vec4(Idiff, Idiff, Idiff, 0) * diffuse + ambient;
		gl_FragColor = (pcol + vec4(0,0,0, 0.5+Idiff*0.5)) * sign(col.a);
		//gl_FragColor = col;
	}
		//gl_FragColor = vec4(Idiff, Idiff, Idiff, 1);// * vec4(0,0.67,0.93,1); //gl_FragColor = vec4(0,0.3,0.6,1);
		/*
	else if (col.b <= 0.2 && col.b > 0.10)
		gl_FragColor = vec4(col.rgb, 1);*/ //gl_FragColor = vec4(0,0.67,0.93,1);
	else
		discard;
}
